import React from 'react';
import {
  Text,
  View,
  StyleSheet,
  Image,
  FlatList
} from 'react-native';
var Dimensions = require('Dimensions');
var {width} = Dimensions.get('window');
import {setSpText} from './ScreenUtil'
export default class RecommendOrgan extends React.Component {
 // 初始化模拟数据
 constructor(props) {
    super(props);
    this.state={
        refreshing: false,//初始化不刷新
    }
    _footer = () => (
        <Text style={{fontSize:setSpText(28), alignSelf: 'center'}}>到底啦，没有啦！</Text>
    )
  }
  render() {
    return (
        <View style={styles.itemBox}>
                <FlatList
                data={this.props.dataList}
                ListFooterComponent={this._footer}
                showsVerticalScrollIndicator={false}
                keyExtractor={(item, index) => item.key}
                renderItem={({item}) => 
                    <View key={item.rowID} style={styles.item}>
                        <View style={styles.itemLeft}>                 
                           <Image style={styles.teacherIcon} source={require('../assets/imgs/teacher.png')} />             
                        </View>
                        <View style={styles.itemRight}>
                            <Text style={styles.name}>{item.name}</Text>
                            <Text style={styles.addressPhone}>地址：{item.address}</Text>
                            <Text style={styles.addressPhone}>电话：{item.phone}</Text>
                        </View> 
                    </View>
                }
                />
        </View>
    );
  }
}

const styles = StyleSheet.create({
    itemBox:{
        flexDirection: 'row',
        flexWrap: 'wrap',
        alignItems: 'flex-start',
        backgroundColor:'#F7F7F9',
    },
    item: {
        // paddingTop:15,
        // paddingBottom:15,
        padding:15,
        marginTop:5,
        flexDirection: 'row',
        backgroundColor:'#fff',
        justifyContent:'space-between'
    },
    itemLeft:{
        width:78,
        marginRight:10,
    },
    teacherIcon:{
        width:78,
        height:104,
    },
    itemRight:{
        width:width - 118,
    },
    name:{
        fontWeight: 'bold',
        fontSize:18,
        paddingBottom:8,
        color:'#333'
    },
    addressPhone:{
        paddingBottom:6,
    },
});
  